package ink.lovejinhu.think.tree;

import org.junit.Test;

import java.util.Stack;

/**
 * @author jinhu
 * created 2021-05-08 17:02
 */
public class StudyStack {
    @Test
    public void test() {
        Stack<Integer> var = new Stack<>();
        /**
         * 存数  push
         */
        var.push(1);
        var.push(2);
        var.push(3);
        /**
         *  peek  只会将栈顶的元素取出来，但是不会删除栈顶的元素
         */
        System.out.println(var.peek());  //3
        System.out.println(var.peek());    //3
        System.out.println(var.peek());        //3
        /**
         * pop
         */
        System.out.println(var.pop());
        System.out.println(var.pop());
        System.out.println(var.pop());

    }
}
